package net.caixiaomi.info.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;

import net.caixiaomi.info.R;
import net.caixiaomi.info.app.CommonApp;
import net.caixiaomi.info.base.quickadapter.BaseQuickAdapter;
import net.caixiaomi.info.base.quickadapter.BaseViewHolder;
import net.caixiaomi.info.model.PayWayItem;

public class PayWayAdapter extends BaseQuickAdapter<PayWayItem, BaseViewHolder> {
    public PayWayAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, PayWayItem item) {
        try {
            helper.setText(R.id.title, item.getPayName());
            helper.getView(R.id.checkbox).setSelected(item.isSelected());

            Glide.with(CommonApp.getInstance()).load(item.getPayImg()).into((ImageView) helper.getView(R.id.image));
            helper.setGone(R.id.line, helper.getAdapterPosition() != (getData().size() - 1));

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
